package com.basics.common.utils.security;


import com.fasterxml.jackson.annotation.JsonIgnore;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import java.util.Collection;
import java.util.Set;

public abstract class LoginUser implements UserDetails {
    private static final long serialVersionUID = 1L;
    private String token;
    private Long loginTime;
    private Long expireTime;
    private Set<String> permissions;

    @JsonIgnore
    public String getPassword() {
        return null;
    }

    @JsonIgnore
    public String getUsername() {
        return null;
    }

    @JsonIgnore
    public String getUserId() {
        return null;
    }

    @JsonIgnore
    public boolean isAccountNonExpired() {
        return true;
    }

    @JsonIgnore
    public boolean isAccountNonLocked() {
        return true;
    }

    @JsonIgnore
    public boolean isCredentialsNonExpired() {
        return true;
    }

    @JsonIgnore
    public boolean isEnabled() {
        return true;
    }

    public Collection<? extends GrantedAuthority> getAuthorities() {
        return null;
    }

    public LoginUser() {
    }

    public String getToken() {
        return this.token;
    }

    public Long getLoginTime() {
        return this.loginTime;
    }

    public Long getExpireTime() {
        return this.expireTime;
    }

    public Set<String> getPermissions() {
        return this.permissions;
    }

    public void setToken(final String token) {
        this.token = token;
    }

    public void setLoginTime(final Long loginTime) {
        this.loginTime = loginTime;
    }

    public void setExpireTime(final Long expireTime) {
        this.expireTime = expireTime;
    }

    public void setPermissions(final Set<String> permissions) {
        this.permissions = permissions;
    }
}
